package com.zq.sysuser.controller;

import com.zq.common.util.Result;
import com.zq.sysuser.dao.dto.PasswordDto;
import com.zq.sysuser.service.ResetPassword;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 张乔
 * @Date 2024/5/8 17:34
 * @Description 重置密码
 */
@RestController
@RequestMapping("/sys")
public class ResetPasswordController {

    @Resource
    private ResetPassword resetPassword;


    //重置密码，根据邮箱号发送验证码
    @GetMapping("/resetPassword")
    public Result<String> resetPassword(@RequestParam("email") String email){
        System.out.println(email+"=================");
     resetPassword.sendEmail(email);
        return Result.success();
    }


    @GetMapping("/sendSysCode")
    public Result<String> sendSysCode(@RequestParam("code") String code,@RequestParam("email") String email){
resetPassword.sendSysCode(code,email);
        return Result.success();
    }

    @PostMapping("/sendSysPassword")
    public Result<String> sendSysPassword(@RequestBody PasswordDto passwordDto){
resetPassword.sendSysPassword(passwordDto);

        return Result.success();
    }


}
